package com.ruoyi.project.game.gamecategory.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.game.gamecategory.mapper.GameCategoryMapper;
import com.ruoyi.project.game.gamecategory.domain.GameCategory;
import com.ruoyi.project.game.gamecategory.service.IGameCategoryService;
import com.ruoyi.common.utils.text.Convert;
import com.ruoyi.framework.aspectj.lang.annotation.DataSource;
import com.ruoyi.framework.aspectj.lang.enums.DataSourceType;

/**
 * 游戏分类关联Service业务层处理
 * 
 * @author shixiangwen
 * @date 2020-02-12
 */
@Service
@DataSource(value = DataSourceType.GAME)
public class GameCategoryServiceImpl implements IGameCategoryService {
	@Autowired
	private GameCategoryMapper gameCategoryMapper;

	/**
	 * 查询游戏分类关联
	 * 
	 * @param id 游戏分类关联ID
	 * @return 游戏分类关联
	 */
	@Override
	public GameCategory selectGameCategoryById(Long id) {
		return gameCategoryMapper.selectGameCategoryById(id);
	}

	/**
	 * 查询游戏分类关联列表
	 * 
	 * @param gameCategory 游戏分类关联
	 * @return 游戏分类关联
	 */
	@Override
	public List<GameCategory> selectGameCategoryList(GameCategory gameCategory) {
		return gameCategoryMapper.selectGameCategoryList(gameCategory);
	}

	/**
	 * 新增游戏分类关联
	 * 
	 * @param gameCategory 游戏分类关联
	 * @return 结果
	 */
	@Override
	public int insertGameCategory(GameCategory gameCategory) {
		gameCategory.setCreateTime(DateUtils.getNowDate());
		return gameCategoryMapper.insertGameCategory(gameCategory);
	}

	/**
	 * 修改游戏分类关联
	 * 
	 * @param gameCategory 游戏分类关联
	 * @return 结果
	 */
	@Override
	public int updateGameCategory(GameCategory gameCategory) {
		gameCategory.setUpdateTime(DateUtils.getNowDate());
		return gameCategoryMapper.updateGameCategory(gameCategory);
	}

	/**
	 * 删除游戏分类关联对象
	 * 
	 * @param ids 需要删除的数据ID
	 * @return 结果
	 */
	@Override
	public int deleteGameCategoryByIds(String ids) {
		return gameCategoryMapper.deleteGameCategoryByIds(Convert.toStrArray(ids));
	}

	/**
	 * 删除游戏分类关联信息
	 * 
	 * @param id 游戏分类关联ID
	 * @return 结果
	 */
	@Override
	public int deleteGameCategoryById(Long id) {
		return gameCategoryMapper.deleteGameCategoryById(id);
	}
}
